<%@ Page Title="Order History" Language="C#" MasterPageFile="~/Users/UserDefault.master" AutoEventWireup="true" CodeFile="OrderHistory.aspx.cs" Inherits="Users_OrderHistory" %>

<asp:Content ID="Content1" ContentPlaceHolderID="mainContent" Runat="Server">
    <div>
        <div>
            <asp:GridView ID="gvOrderList" runat="server" AutoGenerateColumns="False" 
                Width="100%" OnRowCommand="gvOrderList_RowCommand" 
                onrowdatabound="gvOrderList_RowDataBound">
                <Columns>
                    <asp:TemplateField  HeaderText="Order No" SortExpression="OrderId" ItemStyle-HorizontalAlign="Center">
                        <ItemTemplate>
                            <asp:LinkButton runat="server" ID="lnkOrderId" CommandName="Select" CommandArgument='<%# Eval("OrderId") %>'><%# Eval("OrderNo","#{0}") %></asp:LinkButton>
                        </ItemTemplate>

<ItemStyle HorizontalAlign="Center"></ItemStyle>
                    </asp:TemplateField>
                    
                    <asp:BoundField DataField="AddedDate" HeaderText="Added Date" 
                        SortExpression="AddedDate" />
                    <asp:BoundField DataField="SubTotal" HeaderText="Invoice Total" 
                        SortExpression="SubTotal" ItemStyle-HorizontalAlign="Right"
                         DataFormatString="{0:c}" >
        <ItemStyle HorizontalAlign="Right"></ItemStyle>
                    </asp:BoundField>
                    <asp:TemplateField HeaderText="Payment Status" SortExpression="Status">
                        <ItemTemplate>
                            <asp:Label ID="Label1" runat="server" Text='<%# Bind("Status") %>'></asp:Label>&nbsp;
                            <asp:LinkButton ID="lBtnCancel" Visible="false" runat="server" CommandName="CancelDelete" CommandArgument='<%# Eval("OrderId") %>'>[Cancel]</asp:LinkButton>
                        </ItemTemplate>
                        <ItemStyle HorizontalAlign="Center" />
                    </asp:TemplateField>
                </Columns>
            </asp:GridView>
        </div>
    
    <br />
    <br />
    <br />
    
    <div style="margin: 0 10% 0 10%; display: block;">
        
            <asp:Panel ID="pnlOrderDetails" runat="server" Visible="false">
                <div>
                    <div>
                        <img src="../images/Logo.PNG" alt="Ample International" style="float:left" />
                        <div style="float:right;">
                            <b>Ample International</b><br />
                            205 Airport Road, Bldg A, Suite 30<br />
                            Missisauga, Ontario, L4V 1E1, Canada
                        </div>
                    </div>
                    <br />
                    <br />
                    <br />
                    <br />
                    <hr/>
                    <div style="float:left">
                        Order No: <asp:Literal ID="ltlOrderId" runat="server"></asp:Literal><br/>
                        Order Date: <asp:Literal ID="ltlAddedDate" runat="server"></asp:Literal><br/>
                        Invoice No: <asp:Literal ID="ltlInvoiceNo" runat="server"></asp:Literal><br/>
                    </div>
                    <div style="float:right">
                        Ample ID#: <asp:Literal ID="ltlAmpleID" runat="server"></asp:Literal><br/>  
                        Distributor Name: <asp:Literal ID="ltlUserName" runat="server"></asp:Literal><br/>
                    </div>
                    <br />
                    <br />
                    <br />
                    <br />  
                    <div>
                        <asp:GridView runat="server" ID="gvwOrderDetails" Width="100%" DataKeyNames="OrderItemId" AutoGenerateColumns="false">
                            <Columns>
                                <asp:BoundField Visible="false" DataField="OrderItemId"/>
                                <asp:BoundField Visible="true" DataField="Title" HeaderText="Name" ItemStyle-Width="20%"/>
                                <asp:BoundField DataField="Description" HeaderText="Description" 
                                    SortExpression="Description" />
                                <asp:BoundField Visible="true" DataField="UnitPrice" ItemStyle-Width="20%" DataFormatString="{0:c}" ItemStyle-HorizontalAlign="Right" HeaderText="Price"/>
                            </Columns>
                        </asp:GridView>
                    </div>
                    <br />
                    <br />
                    <div style="height: 220px;">
                        <table style="float: right; border: 1px solid #000000; border-collapse: collapse" cellpadding="4px" cellspacing="2px">
                            <colgroup>
                                <col style="border-right: 1px solid #000000;"/>
                            </colgroup>
                                <tr>
                                    <td>
                                        Item Total
                                    </td>
                                    <td>
                                        <asp:Literal ID="ltlItemTotal" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Shipping &amp; Handling
                                    </td>
                                    <td>
                                        <asp:Literal ID="ltlShipping" runat="server" Text="$0" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        G.S.T./H.S.T. Tax
                                    </td>
                                    <td>
                                        <asp:Literal ID="ltlGST" runat="server" Text="$0" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        P.S.T. Tax
                                    </td>
                                    <td>
                                        <asp:Literal ID="ltlPST" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td colspan="2">
                                        <hr />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Invoice Total
                                    </td>
                                    <td>
                                        <asp:Literal ID="ltlInvoiceTotal" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Payments Recieved
                                    </td>
                                    <td>
                                        <asp:Literal ID="ltlPaymentsRecieved" runat="server" />
                                    </td>
                                </tr>
                                <tr>
                                    <td>
                                        Outstanding Balance
                                    </td>
                                    <td>
                                        <asp:Literal ID="ltlBalance" runat="server" />
                                    </td>
                                </tr>
                            
                        </table>
                    </div>
                 </div>
            </asp:Panel>
           
        </div> 

    </div>
        
</asp:Content>

